package myJs.myPkg.reactBootstrap

import japgolly.scalajs.react.CtorType.ChildArg
import japgolly.scalajs.react.vdom.VdomElement
import japgolly.scalajs.react.{Children, JsComponent, JsFnComponent}
import slinky.readwrite.ObjectOrWritten

import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport

object Popover {
  case class Props(
      id: String
  )

  @js.native
  @JSImport("react-bootstrap", "Popover")
  object RawComponent extends js.Object {

    val Header: js.Object = js.native

    val Body: js.Object = js.native

  }

  object Header {
    val Component = JsComponent[Null, Children.Varargs,Null](RawComponent.Header)

    def apply(children: ChildArg*) = Component(children: _*)

  }

  object Body {

    val Component = JsComponent[Null, Children.Varargs,Null](RawComponent.Body)

    def apply(children: ChildArg*) = Component(children: _*)

  }

  val Component = JsComponent[ObjectOrWritten[Props], Children.Varargs,Null](RawComponent)

  def apply(
      id: String
  )(children: ChildArg*): VdomElement = Component(Props(id))(children: _*)

}
